<!DOCTYPE html>
<html class="loginHtml">
<head>
    <meta charset="utf-8">
    <title>银行保险后台管理</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="icon" href="favicon.ico">
    <link rel="stylesheet" href="layui/css/layui.css" media="all"/>
    <style>
        /*登录*/
        .layui-block {
            width: 100% !important;
        }

        .loginHtml, .loginBody {
            background: url('images/login_bg4.jpg');
            background-size: 100% 100%;
            width: 100%;
            height: 100%;
        }

        .loginBody form.layui-form {
            padding: 0 20px;
            width: 334px;
            height: 355px;
            position: absolute;
            left: 50%;
            top: 50%;
            margin: -150px 0 0 -150px;
            -webkit-box-sizing: border-box;
            -moz-box-sizing: border-box;
            -o-box-sizing: border-box;
            box-sizing: border-box;
            background: #fff;
            -webkit-border-radius: 5px;
            -moz-border-radius: 5px;
            border-radius: 5px;
            box-shadow: 0 0 50px #009688;
        }

        .login_face {
            margin: -55px auto 20px;
            width: 100px;
            height: 100px;
            -webkit-border-radius: 50%;
            -moz-border-radius: 50%;
            border-radius: 50%;
            border: 5px solid #fff;
            overflow: hidden;
            box-shadow: 0 0 30px #009688;
        }

        .login_face img {
            width: 100%;
        }

        .loginBody .layui-form-item {
            position: relative;
        }

        .loginBody .layui-form-item label {
            position: absolute;
            color: #757575;
            left: 10px;
            top: 9px;
            line-height: 20px;
            background: #fff;
            padding: 0 5px;
            font-size: 14px;
            cursor: text;
        }

        .loginBody .layui-form-item.layui-input-focus label {
            top: -10px;
            font-size: 12px;
            color: #ff6700;
        }

        .loginBody .layui-form-item.layui-input-active label {
            top: -10px;
            font-size: 12px;
        }

        .loginBody .layui-input::-webkit-input-placeholder {
            color: #fff;
        }

        .loginBody .layui-input::-moz-placeholder {
            color: #fff;
        }

        .loginBody .layui-input:-ms-input-placeholder {
            color: #fff;
        }

        .loginBody .layui-input::placeholder {
            color: #fff;
        }

        .loginBody .layui-form-item.layui-input-focus input {
            border-color: #ff6700 !important;
        }

        .loginBody .layui-input-focus .layui-input::-webkit-input-placeholder {
            color: #757575;
        }

        .loginBody .layui-input-focus .layui-input::-moz-placeholder {
            color: #757575;
        }

        .loginBody .layui-input-focus .layui-input:-ms-input-placeholder {
            color: #757575;
        }

        .loginBody .layui-input-focus .layui-input::placeholder {
            color: #757575;
        }

        .info {
            color: rgba(26, 188, 156, 1);
            padding-bottom: 1px;
            font-size: 16px;
            font-weight: bold;
            text-align: center;
        }

        .info1 {
            margin-bottom: 30px;
        }

        .info2 {
            margin-top: 100px;
            color: #d2d2d2
        }
    </style>
    <script type="text/javascript">
        if (window != top)
            top.location.href = location.href;
    </script>
</head>
<body class="loginBody">
<form class="layui-form">
    <div class="login_face"><img src="images/bank.png" class="userAvatar"></div>
    <label class="layui-form-label-col info">银行保险后台管理</label>
    <label class="layui-form-label-col info info1">Background Management System</label>
    <div class="layui-form-item input-item">
        <label for="mobile">用户名</label>
        <input type="text" placeholder="请输入手机号码" autocomplete="off" id="mobile" class="layui-input">
    </div>
    <div class="layui-form-item input-item">
        <label for="password">密码</label>
        <input type="password" placeholder="请输入密码" autocomplete="off" id="password" class="layui-input">
    </div>
    <div class="layui-form-item">
        <button class="layui-btn layui-block" lay-filter="login" lay-submit>登录</button>
    </div>

    <label class="layui-form-label-col info info2">CopyRight @ 银行保险网络科技 2019</label>
</form>
<script type="text/javascript" src="js/jquery-3.1.1.min.js"></script>
<script src="plugins/jqgrid/jquery.jqGrid.min.js"></script>
<script type="text/javascript" src="layui/layui.js"></script>
<script type="text/javascript" src="js/common.js"></script>
<script>
layui.use('form', function () {
        var form = layui.form;
        //登录按钮
        form.on("submit(login)", function (data) {
            let elem = this;
            $(this).text("登录中...").attr("disabled", "disabled").addClass("layui-disabled");
            setTimeout(function () {
                let error = false;
                let vm = {};
                vm.mobile = $("#mobile").val();
                vm.password = $("#password").val();
                var data = "mobile=" + vm.mobile + "&password=" + vm.password;
                if (vm.mobile === "") {
                    layui.use('layer', function () {
                        var layer = layui.layer;
                        layer.msg("请输入登录账号")
                    })
                    $(elem).text("登录").attr("disabled", false).removeClass("layui-disabled");
                    return false;
                } else if (vm.password === "") {
                    layui.use('layer', function () {
                        var layer = layui.layer;
                        layer.msg("请输入密码")
                    })
                    $(elem).text("登录").attr("disabled", false).removeClass("layui-disabled");
                    return false;
                }
                $.ajax({
                    type: "POST",
                    url: baseURL + "sys/login",
                    data: data,
                    dataType: "json",
                    success: function (r) {
                        if (r.code === 0) {//登录成功
                            localStorage.setItem("token", r.token);
                            parent.location.href = 'index.html';
                        } else {
                            $(elem).text("登录").attr("disabled", false).removeClass("layui-disabled");
                            layui.use('layer', function () {
                                var layer = layui.layer;
                                layer.msg(r.msg)
                            })
                        }
                    }
                })
            }, 500);
            return false;
        });

        //表单输入效果
        $(".loginBody .input-item").click(function (e) {
            e.stopPropagation();
            $(this).addClass("layui-input-focus").find(".layui-input").focus();
        });
        $(".loginBody .layui-form-item .layui-input").focus(function () {
            $(this).parent().addClass("layui-input-focus");
        });
        $(".loginBody .layui-form-item .layui-input").blur(function () {
            $(this).parent().removeClass("layui-input-focus");
            if ($(this).val() != '') {
                $(this).parent().addClass("layui-input-active");
            } else {
                $(this).parent().removeClass("layui-input-active");
            }
        })
    })
</script>
</body>
</html>